package com.ustudy.entity.ec;

import java.util.Collections;
import java.util.List;

import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.ustudy.core.dao.support.entity.LongIdEntity;
/**
 * 商品
 * @author caizh
 *
 */

import com.ustudy.entity.commons.PathFile;
@SuppressWarnings("serial")
@Entity(name="Goods")
@Table(name="EC_GOODS")
public class Goods extends LongIdEntity {
	
	private String name;
	
	@ManyToOne(cascade={CascadeType.REFRESH},fetch=FetchType.LAZY)
	@JoinColumn(name="IMG_ID")
	private PathFile img;
	
	@Column
	@Lob
	@Basic(fetch=FetchType.LAZY)
	private String body;
	
	/**
	 * 属性配置，详细描述商品的一些指标
	 */
	@Column
	@Lob
	@Basic(fetch=FetchType.LAZY)
	private String properties;
	
	/**
	 * 商品配置，支付方式，跳转链接等等
	 */
	@Column
	@Lob
	@Basic(fetch=FetchType.LAZY)
	private String config;
	
	@Enumerated
	private GoodsType goodsType=GoodsType.SINGLE;
	
	@ManyToOne(cascade={CascadeType.REFRESH},fetch=FetchType.LAZY)
	@JoinColumn(name="STORE_ID")
	private GoodsStore goodsStore;
	
	private Double showPrice;
	
	private Double price;
	
	private Long storeNum;
	
	private Long storeTime=System.currentTimeMillis();
	
	private Long offTime;
	
	private Boolean status=false;
	
	
	public static enum GoodsType{
		SINGLE("单卖"),MULTI("库存");
		private final String label;
		private GoodsType(String label){
			this.label=label;
		}
		public String getLabel() {
			return label;
		}
	}

	public static enum GoodsClassify{
		LOCAL("本地购买"),OTHER_PAY("外部商品");
		private final String label;
		private GoodsClassify(String label){
			this.label=label;
		}
		public String getLabel() {
			return label;
		}
	}

	public String getName() {
		return name;
	}



	public void setName(String name) {
		this.name = name;
	}


	public String getBody() {
		return body;
	}



	public void setBody(String body) {
		this.body = body;
	}



	public String getProperties() {
		return properties;
	}



	public void setProperties(String properties) {
		this.properties = properties;
	}



	public GoodsType getGoodsType() {
		return goodsType;
	}



	public void setGoodsType(GoodsType goodsType) {
		this.goodsType = goodsType;
	}



	public GoodsStore getGoodsStore() {
		return goodsStore;
	}



	public void setGoodsStore(GoodsStore goodsStore) {
		this.goodsStore = goodsStore;
	}



	public Double getShowPrice() {
		return showPrice;
	}



	public void setShowPrice(Double showPrice) {
		this.showPrice = showPrice;
	}



	public Double getPrice() {
		return price;
	}



	public void setPrice(Double price) {
		this.price = price;
	}



	public Long getStoreNum() {
		return storeNum;
	}



	public void setStoreNum(Long storeNum) {
		this.storeNum = storeNum;
	}



	public Long getStoreTime() {
		return storeTime;
	}



	public void setStoreTime(Long storeTime) {
		this.storeTime = storeTime;
	}



	public Long getOffTime() {
		return offTime;
	}



	public void setOffTime(Long offTime) {
		this.offTime = offTime;
	}



	public Boolean getStatus() {
		return status;
	}



	public void setStatus(Boolean status) {
		this.status = status;
	}

	public String getConfig() {
		return config;
	}



	public void setConfig(String config) {
		this.config = config;
	}



	public PathFile getImg() {
		return img;
	}



	public void setImg(PathFile img) {
		this.img = img;
	}
}
